package com.lims.dao.admin.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.lims.dao.admin.IAdminDAO;
import com.lims.dao.base.BaseDAOImpl;
import com.lims.po.admin.Admin;

public class AdminDAOImpl extends BaseDAOImpl<Admin> implements IAdminDAO {

	private static final String className = AdminDAOImpl.class.toString();


	public List<Admin> selectAdmin(String adminName, String MD5Password) {
		String hql = "from Admin where userName=:adminName and  md5Password=:md5Password ";

		Map<String, Object> parameters = new HashMap<String, Object>();
		parameters.put("adminName", adminName);
		parameters.put("md5Password", MD5Password);

		return super.ExecuteQuery(hql, parameters, className + "-->selectAdmin(String adminName, String MD5Password)");
	}
	

	public List<Admin> selectAll() {

		String hql = "from Admin order by pid desc";
		return super.ExecuteQuery(hql, className + "-->selectAll");
	}

	public Long countObject() {
		return super.countObject(className + "-->selectAll");
	}

	public Admin selectById(Object id) {

		return (Admin) super.selectById(id, className + "-->selectById");
	}

	public long saveAdmin(Admin entity) {
		return super.saveObject(entity, className + "-->saveAdmin(Admin entity)");
	}

	public boolean updateAdmin(Admin entity) {
		return super.updateObject(entity, className + "-->updateAdmin(Admin entity)");
	}

	public Admin selectAdminByAdminName(String adminName) {
		String hql = "from Admin where userName=:adminName";
		Map<String, String> map = new HashMap<String, String>();
		map.put("adminName", adminName);
		return (Admin) super.selectSingle(hql, map, className + "-->selectAdminByAdminName(String adminName)");
	}

	public boolean deleteAdmin(Admin entity) {
		return super.deleteObject(entity, className + "-->deleteAdmin(Admin entity)");
	}

	public boolean deleteAdminByIds(Object[] idCollection) {
		return super.deleteObject(idCollection, className + "-->deleteAdminByIds(Object[] idCollection)");
	}


	public Boolean passwordModification(int pid, String plainPassword,
			String MD5Password) {
		return null;
	}


	public List<Admin> selectLoginByRoleType(long roleId, long journalID) {
		// TODO Auto-generated method stub
		return null;
	}







}
